package com.woniuxy.yogaapp.handler;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.woniuxy.yogaapp.pojo.Coach;
import com.woniuxy.yogaapp.pojo.YogaClub;
import com.woniuxy.yogaapp.service.CoachService;
import com.woniuxy.yogaapp.service.YogaClubService;

import lombok.Data;

@Data
@Controller
@RequestMapping("/map")
@Scope("prototype")
public class MapHandler {
	@Resource
	private CoachService coachServce;
	@Resource
	private YogaClubService yogaClubService;

	// 查询所有教练
	@RequestMapping("/showcoach")
	@ResponseBody
	public List<Coach> coachAll() {
		List<Coach> allCoach = coachServce.findAllCoach();
		return allCoach;
	}

	// 查询所有会馆
	@RequestMapping("/showclub")
	@ResponseBody
	public List<YogaClub> clubAll() {
		List<YogaClub> allClub = yogaClubService.findAllYogaClub();
		return allClub;
	}
}
